clc; clear all; addpath('E:\PhotoShop Algortihm\Image Processing\PS Algorithm'); Image=imread('4.jpg'); Image=double(Image)*0; coeff_r=1; coeff_g=1; coeff_b=1; [row, col, layer]=size(Image); % 花环的中心位置 Center_X=(col+1)/2; Center_Y=(row+1)/2; a=150; % 控制花瓣的半径 N=720; % 控制组成花瓣的点数,越大,显得越密 k=4; % 控制花环的形状,不同的k生成不同形状的花环 delta_angle=360/N; for angle=0:delta_angle:360 theta=angle*pi/180; r=(a*sin(k*theta)); x=(r*cos(theta)); y=(r*sin(theta)); x0=floor(x+Center_X); y0=floor(Center_Y-y); Image(y0,x0,1)=coeff_r; Image(y0,x0,2)=coeff_g; Image(y0,x0,3)=coeff_b; end imshow(Image);
K=2
K=3
K=4
原文地址:http://blog.csdn.net/matrix_space/article/details/42214863