dimension mismatch

13 Ansichten (letzte 30 Tage)
FIR
FIR am 14 Okt. 2011
Kommentiert: Image Analyst am 29 Jun. 2016
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

Akzeptierte Antwort

Image Analyst
Image Analyst am 14 Okt. 2011
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 Kommentare
Michael Liu
Michael Liu am 29 Jun. 2016
Hi Image Analyst,
How would you assign the 2D image to each color plane one at a time?
Image Analyst
Image Analyst am 29 Jun. 2016
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;

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Geometric Transformation and Image Registration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by