How to plot RS chart using Matlab

178 Views Asked by At

I am working with some video data and I expected to see some self similarity when plotting the RS chart, instead I got zigzagy lines. I would like some of you to check my code segment & tell me if I did something wrong in it. The video file has 114 frames & I have a seperate function that computes the R over sigma and returns that value plus the no of pixels.

points=zeros(7,5,1);
RS=zeros(7,5,1);
for l=1:7
    x= floor(rand()*240);
    y=floor(rand()*320);
im_frame=image_data(x,y,1,:);
im_frame=im_frame(:);

for i=1:5
        N=floor(length(im_frame)/2^(i-1));
    for j=1:2^(i-1)
        [pt,RSt]=calcRSrange(im_frame((i-1)*N+1:i*N));
        points(l,i) = pt+points(l,i);
        RS(l,i)=RSt+RS(l,i);
    end
    points(l,i)=points(l,i)/j;
    RS(l,i)=RS(l,i)/j;
end
end
log_RS=log(RS);
log_points=log(points);
figure
plot(log_points',log_RS')
xlabel('log no. of pixels')
ylabel('Log RS value')

Thank you in advance:)

0

There are 0 best solutions below