Borrar filtros
Borrar filtros

plz help me out with this error..matrix dimension mismatch

1 visualización (últimos 30 días)
Rajesh Kumar
Rajesh Kumar el 28 de Feb. de 2012
part of my code is
img1=imread('img.jpg'); [m n]=size(img1); imnoise=img1+64*randn(m,n);
its giving an error like this
??? Error using ==> plus Matrix dimensions must agree.
Error in ==> prog4c at 6 imnoise = img1 + 64*randn([m,n]);
thanqq

Respuestas (1)

Kaustubha Govind
Kaustubha Govind el 28 de Feb. de 2012
IMREAD usually returns a 3-D matrix, but you are collapsing the size to a 2-D by using:
[m n]=size(img1);
Try:
[m n q]=size(img1);
imnoise=img1+64*randn(m,n,q);
  1 comentario
Rajesh Kumar
Rajesh Kumar el 1 de Mzo. de 2012
my input is color img..so its in 3D..i converted to gray and got the output...thanq

Iniciar sesión para comentar.

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by