I am new to matlab and I am right now working on dynamic texture synthesis. I am trying to create a simple ocean wave model just by changing the pixel values and applying different values of rgb color values to get the proper color intensity. Creating a frame and storing it in a video. But I have a difficulty with it: not actually looking like an ocean wave.
i referred to Matlab/CUDA: ocean wave simulation, but I am not getting how to store each frame in a video.
Here is my Code:
x = 1; % horizontal distance
lambda = 150; % wavelength
c = 5; % wave speed
A = 9; % wave amplitude
images= ones(500,500,3);
imshow(images)
start=0;
k=0;
writerobj=VideoWriter('new4.avi');
writerobj.FrameRate=6;
open(writerobj);
rint=200;
gint=200;
bint=200;
height=400;
intinc=1;
images(100:500,:,3)=150;
b=0;
for i=0:1:60
for height =100:1:500;
for t= 0:1:499
y=7*sin((2*3.14/lambda)*x-b);
y = round(y);
y=y+height;
images(y,x+1,1)=rint;
images(y,x+1,2)=gint;
images(y,x+1,3)=bint;
temp=x;
intex=x;
x=x+1;
end
if(rint<2250&&bint<225)
rint=rint+intinc;
gint=gint+intinc;
bint=bint+intinc;
else
rint=225;
gint=225;
bint=200;
b=b+10;
end
x=1;
start=0;
end
images=uint8(images);
writeVideo(writerobj,images);
images= ones(500,500,3);
images(100:500,:,3)=150;
rint=125;
gint=125;
bint=125;
end
close(writerobj);
imshow(images);