%%% Perlin noise%%% wood_textureclc;clear all;close all;addpath (' E:\PhotoShop algortihm\image processing\ps Algorithm ' ); Image=imread (' 9.jpg '); image=double (Image); [Row,col,layer]=size (Image); Basenoise=generate_basenoise (Row, col);p ersistance = 0.5;octavecount=6; Cloud_texture=cloud_generate (basenoise,persistance,octavecount);% figure,% imshow (Cloud_texture); turbePower=0.45 ;p eriod=10; center_x= (col+1)/2; center_y= (row+1)/2; Wood=zeros (Row, col); for I=1:row for J=1:col xvalue= (j-center_x)/col; Yvalue= (i-center_y)/row; Distvalue=sqrt (Xvalue*xvalue+yvalue*yvalue) +turbepower*cloud_texture (I,J); Wood (i,j) =abs (sin (2*period*distvalue*pi)) *128; Endendfigure, Imshow (wood/128); Image_new=image;image_new (:,:, 1) =uint8 (wood+80); Image_new (:,:, 2) =uint8 (Wood+30) ; Image_new (::, 3) =uint8 (+); Figure,imshow (image_new/255);%%% Cloud generatefunction cloud_texture=cloud_generate ( Basenoise,persistance,octavecount) [Row, Col]=size (basenoise); Cloud_texture=zeros (row,col); totalamplitude = 0.0;for I=0:octavecount amplitude=persistance.^ (octavecount-i); % Amplitude=persistance.^i; Totalamplitude=totalamplitude+amplitude; Cloud_texture=cloud_texture+generate_smoothnoise (Basenoise, i) *amplitude;endcloud_texture=cloud_texture/ Totalamplitude;
Using Perlin noise to generate wood texture