cant display my new image
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hello,
i have an excericse ;
i have a little pic of mozart and a big one. i seperated my big pic into 30 pieces and replaced them with the small one, now i cant show my image. can any1 help please?
a=imread('smallMozart.tiff'); # the size is 38x25
b=imread('bigMozart.tiff'); # the size is 1140x750
disp(size(b));
disp(size(a));
c=mat2cell(b,[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38],[25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25]);
for i=1:30
for j=1:30
c{i,j}=a;
end
end
imshow(c)
thanks
1 commentaire
Jan
le 10 Avr 2021
Modifié(e) : Jan
le 10 Avr 2021
You get an error message, if you provide a cell array to the imshow command. Then it i useful to share the message with the readers. It is easier to solve a problem than to guess, what the problem is.
Why do you create c by mat2cell only to overwrite it immediately?
Avoid monsters as:
c=mat2cell(b,[38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38],[25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25]);
Easier to read:
c = mat2cell(b, repmat(38, 1, 30), repmat(25, 1, 30));
You can simplify:
for i=1:30
for j=1:30
c{i,j}=a;
end
end
to:
c(:) = {a};
Réponse acceptée
Jan
le 10 Avr 2021
imshow does not accept cell arrays as input. It needs a matrix.
Either create this matrix directly:
d = repmat(a, 30, 30);
or join the cell elements:
d = cell2mat(c);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!