Index exceeds matrix dimensions.

1 visualizzazione (ultimi 30 giorni)
SARAH NIEKERK
SARAH NIEKERK il 29 Dic 2018
Commentato: SARAH NIEKERK il 29 Dic 2018
global X;
global Y
global B;
X = get(handles.popupmenu1,'value');
B = get(handles.popupmenu2,'value');
NS = getimage(handles.axes3 )
switch(B)
% if strcmp( NS,'GAUSSIAN_NOISE')
case 1
mu = 1; n1 = mu; sigma = (10)^2;
B = (1/sigma*sqrt(2*3.14)) * exp(-((n1 - mu)^2/2*sigma^2))
% elseif strcmp(NS,'GAMMA_NOISE')
case 2
teta = 0.1; k = 1.1; L=10; n1 = 1
B = n1^k-1/(0.5772*(k)*teta^k) * exp(-n1/teta)
% else
case 3
sigma = 0.4
n1 = sqrt(3.14/2*sigma)
B = (n1/sigma^2) * exp(-n1^2/2*sigma^2)
end
AZ = rgb2gray(NS)
Q =wiener2(AZ,B)
% imshow(Q,'parent',handles.axes4)
W = 1./Q
mu = 1
E = ones()
G = diag(Q)
H = eye()
[m n] = size(Q)
alpha2 = 10;
alpha1 = 10
gradI_x = 2
gradI_y = 4
D = sqrt(gradI_x.^2+gradI_y.^2)
F=1
MV = (0.5*(sum(abs(W(m,n)-(mu*E))).^2)) + alpha1*(sum(abs((G(m,n)*W(m,n))-(H*F))))+ alpha2*(sum(abs(D(m,n)*F)))
imshow(MV,'parent',handles.axes4)
i get the input as noisy and blured image in axes3 and in switch case i have apply multiplicative noise and blur which i got at axes3.in axes4 i got filtered input image as Q.now i want to restore image from Q as denoise and deblur so i evaluate formula for multiplicative denoise and deblur.
here i got error as
Index exceeds matrix dimensions.
at
MV = (0.5*(sum(abs(W(m,n)-(mu*E))).^2)) + alpha1*(sum(abs((G(m,n)*W(m,n))-(H*F))))+ alpha2*(sum(abs(D(m,n)*F)))
and also pls guide me to get output image.i did some mistake @MV
  2 Commenti
Stephen23
Stephen23 il 29 Dic 2018
@SARAH NIEKERK: please show the complete error message. This means all of the red text.
SARAH NIEKERK
SARAH NIEKERK il 29 Dic 2018
Index exceeds matrix dimensions.
Error in main>pushbutton2_Callback (line 178)
MV = (0.5*(sum(abs(W(m,n)-(mu*E))).^2)) + alpha1*(sum(abs((G(m,n)*W(m,n))-(H*F))))+ alpha2*(sum(abs(D(m,n)*F)))
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in main (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)main('pushbutton2_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 29 Dic 2018
gradI_x = 2
gradI_y = 4
D = sqrt(gradI_x.^2+gradI_y.^2)
gradI_x and gradI_y are scalars, so D is a scalar.
MV = (0.5*(sum(abs(W(m,n)-(mu*E))).^2)) + alpha1*(sum(abs((G(m,n)*W(m,n))-(H*F))))+ alpha2*(sum(abs(D(m,n)*F)))
tries to access D(m,n) but D is only a scalar.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by