Filter löschen
Filter löschen

how to solve "Subscripted assignment dimension mismatch" error ?

2 Ansichten (letzte 30 Tage)
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]

Akzeptierte Antwort

Guillaume
Guillaume am 19 Nov. 2014
Bearbeitet: Guillaume am 19 Nov. 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;

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by