Azzera filtri
Azzera filtri

how to solve "Subscripted assignment dimension mismatch" error ?

2 visualizzazioni (ultimi 30 giorni)
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]

Risposta accettata

Guillaume
Guillaume il 19 Nov 2014
Modificato: Guillaume il 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;

Più risposte (0)

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by