I have a set of code ,for some RGB images my codes works but for some the coed not work i get an error "Subscripted assignment dimension mismatch",can u tell how to solve it
size of image1=183 275 3
size of image2=238 174 3
size of image3= 72 72 3
I get error for 2nd and 3rd image but not for 1st image
i grt error in this line
trunCoarseImg(:,:,:) = coarseImg((n+1):(end-n),(n+1):(end-n)); where n=6

 採用された回答

Image Analyst
Image Analyst 2011 年 10 月 14 日

0 投票

You're specifying 3 dimensions for trunCoarseImg but only two for coarseImg. You can't do that. You'd have to assign that 2D coarseImg image to each color plane in trunCoarseImg one at a time.

5 件のコメント

FIR
FIR 2011 年 10 月 14 日
my question was for ,my code works for some 3d and dont work for some 3d images
I have given the size of images too
my code works for this image ans its size is
size of image1=183 275 3
ans my code does not work for this image and sizes are
size of image2=238 174 3
size of image3= 72 72 3
Image Analyst
Image Analyst 2011 年 10 月 14 日
I told you why. You can't assign a 2D image to (:,:,:).
the cyclist
the cyclist 2011 年 10 月 14 日
Maybe it only works on the first image because it IS the first image, and the first time through the code (e.g. in a loop)? Try breakpointing in the code to investigate.
Michael Liu
Michael Liu 2016 年 6 月 29 日
Hi Image Analyst,
How would you assign the 2D image to each color plane one at a time?
Image Analyst
Image Analyst 2016 年 6 月 29 日
To assign the red channel (third index = 1), to some 2D array that has the same lateral dimensions (rows and columns), do this
rgbImage(:,:,1) = your2DImage;

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Image Processing Toolbox についてさらに検索

質問済み:

FIR
2011 年 10 月 14 日

コメント済み:

2016 年 6 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by