i need help to compute the algorithe of local AR-2D image by using blocks

1 Ansicht (letzte 30 Tage)
ayoub maa
ayoub maa am 23 Dez. 2018
Kommentiert: ayoub maa am 24 Dez. 2018
hello everyone I want to divide an image into 8 * 8 and for each block I have to do the following steps:
calculate the least squares estimators of the AR-2D model parameter described by:
X (i, j) = teta (1.0) * X (i-1, j) + teta (0.1) * X (i, j-1) + e (i, j)
  after the calculation of teta with the method of least square I have to generate the image with this equation:
X X (i, j) = teta (1.0) * X (i-1, j) + teta (0.1) * X (i, j-1) + e (i, j)
this is my programme
clear all
clc
i=imread('D1.gif');
i= im2double(i);
x = imresize( i,0.25);
[m,n] = size(x);
noise=randn(size(x));
X = mat2cell(x, 8 * ones(1,m/8), 8 * ones(1,n/8));
X=[x(1:40,1:40)]
R = size(X, 1);
C = size(X, 2);
for i=2:R
for j=2:C
Z(i,j)=X(i-1,j)+X(i,j-1);
Z=Z+1;
end
end
teta=inv(z'*z)*z'*X
i have this message
Inner matrix dimensions must agree.
Error in Untitled2 (line 85)
teta=inv(z'*z)*z'*X
who can help me pleas to solve the probleme

Antworten (1)

Image Analyst
Image Analyst am 24 Dez. 2018
See THE FAQ for processing blocks of the image.
The equation
teta=inv(z'*z)*z'*X
is the well known least squares solution, so simply use polyfit() instead of doing it yourself manually.
  1 Kommentar
ayoub maa
ayoub maa am 24 Dez. 2018
yes it is least squares solution but how can i use polyfit() for this equation Z(i,j)=X(i-1,j)+X(i,j-1);

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by