Original image size 769*770, I am geting error as dimension mismatch
Mostrar comentarios más antiguos
Original image size 769*770
org_im=imread('picture1.jpg');
[rows,columns,numberofcolorbands]=size(org_im)
if numberofcolorbands >1 org_im=org_im(:,:,2); end
org_im=im2double(org_im);
figure(1); imshow(org_im);title('Original Image')
f=zeros(771,772); [m,n]=size(f); f(769,770)=size(org_im);
I am getting an error as,
Subscripted assignment dimension mismatch.
Error in sobelmaskspat_d (line 23) f(769,770)=size(org_im);
How to overcome this,
please help me.
Thank you
1 comentario
Jan
el 24 de Nov. de 2014
Please post the complete error message.
Respuesta aceptada
Más respuestas (1)
Guillaume
el 24 de Nov. de 2014
0 votos
What are you trying to do with that line anyway?
size(org_im) is at least a 1x2 array, possibly a 1x3 array if you have colour channels. You're trying to store that array in the single element at (769, 770) of f. Since you can only put one value there, it's never going to work.
2 comentarios
vetri veeran
el 24 de Nov. de 2014
Guillaume
el 24 de Nov. de 2014
f = zeros(size(org_im) + 2); %no need to hardcode the size
f(2:end-1, 2:end-1) = org_im;
f = padarray(org_im, [1 1]);
Categorías
Más información sobre Image Arithmetic en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!