How can I place 4 jpeg images randomly into one 2x2 single larger image?

2 visualizaciones (últimos 30 días)
I can create an image of all 4 of the jpeg images so it makes a 2x2 picture, but i am not sure how to randomize it.
  2 comentarios
Rik
Rik el 22 de Jul. de 2018
What code did you use? It is easier to adapt your existing code than to write new code you'll have to adapt.
ciro saravia
ciro saravia el 22 de Jul. de 2018
Editada: Walter Roberson el 22 de Jul. de 2018
A = imread('wizard.jpg');
B = imread('orc.jpg');
C = imread('hobbit.jpg');
D = imread('elf.jpg');
[row,col,layer] = size(A);
B_resized = imresize(B,[row,col]);
C_resized = imresize(C,[row,col]);
D_resized = imresize(D,[row,col]);
pic = [A,B_resized;C_resized,D_resized];
I just loaded the pictures and resized them so they would have the same dimensions

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 22 de Jul. de 2018
parts = {A, B_resized, C_resized, D_resized};
pic = cell2mat( reshape( parts(randperm(4)), 2, 2 ) );

Más respuestas (0)

Categorías

Más información sobre Convert Image Type en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by