An interesting garland pattern generation function

Source: Internet
Author: User

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);% Wreath's center position center_x= (col+1)/2; Center_y= (row+1)/2;a=150;   % control the radius of petals n=720;  % controls the number of petals formed, the larger the more dense k=4 appear;       % controls the shape of the Garland, different K-generates different shapes of garlands 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;endimshow (image);    



k=2

K=3


K=4



An interesting garland pattern generation function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.