how to solve "Subscripted assignment dimension mismatch" error ?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
namita chandrakar
el 19 de Nov. de 2014
Hi everyone, any help on this will be highly appreciated!!
i have 3D image. Here is my program:
T=imread('....'); %host image
M=imresize(T,[400 400]);
I=im2double(M);
figure(1),imshow(I);
title('Host Image','color','b');
HSV=rgb2hsv(I);
%separate host image into H S & V components
H_plane=HSV(:,:,1);
S_plane=HSV(:,:,2);
V_plane=HSV(:,:,3);
%combine H S & V component
I1(:,:,1)=H_plane;
I1(:,:,2)=S_plane;
I1(:,:,3)=V_plane1;
figure(3),imshow(I1);
When I run the program, the error "subscripted assignment dimension mismatch" will show up, I really dont know how resolve it. I want I1 dimension should be [400 400 3]
0 comentarios
Respuesta aceptada
Guillaume
el 19 de Nov. de 2014
Editada: Guillaume
el 19 de Nov. de 2014
It would be so much easier to help you if you'd shown the complete error message, particularly the bit that tells you which line the error occurs on.
As a guess, the error occurs on
I1(:, :, 1) = H_plane;
because I1 already exists and is not the same size as HSV. So,
I1 = zeros(size(HSV));
before the previous line should solve it.
------
However, I don't particularly see the point of separating the three components to recombine exactly the same way. In the end, your code is equivalent to
I1 = HSV;
1 comentario
Image Analyst
el 19 de Nov. de 2014
And it would have been easier to read if she'd read this: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup. Oh well...for next time...
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!