how to solve "Subscripted assignment dimension mismatch" error ?
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
採用された回答
Guillaume
2014 年 11 月 19 日
編集済み: Guillaume
2014 年 11 月 19 日
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 件のコメント
Image Analyst
2014 年 11 月 19 日
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...
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!