Getting 'Subscripted assignment dimension mismatch' error when my image dimensions match?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Adam Hicks
am 20 Nov. 2017
Beantwortet: Image Analyst
am 21 Nov. 2017
I am trying to overlay one image on another and I keep getting a dimension mismatch error. Here is the relevant block of code:
img = imread('image');
pass = imread('passimage');
v6th = size(img,1)/6;
h6th = size(img,2)/6;
img(round(v6th-size(pass,1)/2):round(v6th+size(pass,1)/2),1:size(pass,2),1:3) = pass;
For reference:
size(pass) == 26, 64, 3
size(img) == 1051, 1425, 3
I have checked that round(v6th-size(pass,1)/2):round(v6th+size(pass,1)/2) evaluates to 162:188 totaling 26.
I am trying to eventually end up with something like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169945/image.png)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 21 Nov. 2017
162 to 188 is 27 numbers, NOT 26.
>> length(162:188)
ans =
27
Recheck your math.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!