Borrar filtros
Borrar filtros

How can I get this to print 1 row of my original 3 images on top of 1 row of my three altered images?

1 visualización (últimos 30 días)
  • Read the three images into your script (the images have to be saved in your working directory so your code can find them)
  • Resize the images to be the same size using imresize
  • Duplicate both of the images and change the RGB values in a way that you like.
  • Concatenate the original and recolored images however you would like - 6 images total
  • Display the collaged image in a figure and add a title
Here is my code and I don't know what is wrong with it. Please help me! Thank you in advance.
% Read three images into script
image1 = imread('Cross_Image.jpg');
image2 = imread('Monkey_Image.jpg');
image3 = imread('Nature_Image.jpg');
% Resize three images to be same size
image1 = imresize(image1, [213,413]);
image2 = imresize(image2, [213,413]);
image3 = imresize(image3, [213,413]);
% imshow(image1)
% imshow(image2)
% imshow(image3)
% Duplicate three images
image11 = imread('Cross_Image.jpg');
image22 = imread('Monkey_Image.jpg');
image33 = imread('Nature_Image.jpg');
% Resize three altered images
image11 = imresize(image11,[213,413]);
image22 = imresize(image22,[213,413]);
image33 = imresize(image33,[213,413]);
% Alter three images
alteredimage1 = image11(:,:,3) + 15;
alteredimage2 = image22(:,:,2) + 53;
alteredimage3 = image33(:,:,2) + 10;
% Show three images
figure;
imshow([image1 image2 image3]);imshow([alteredimage1, alteredimage2, alteredimage3])

Respuesta aceptada

Image Analyst
Image Analyst el 18 de Nov. de 2022
Try putting the altered images in the row below the originals.
imshow([image1 image2 image3; alteredimage1, alteredimage2, alteredimage3], [])
  7 comentarios
Image Analyst
Image Analyst el 18 de Nov. de 2022
When you do this
% Alter three images
alteredimage1 = image11(:,:,3) + 15;
alteredimage2 = image22(:,:,2) + 53;
alteredimage3 = image33(:,:,2) + 10;
You're taking only one color channel. If you want to alter only one color channel you have to initialize altered images.
% Alter three images
alteredimage1 = image11;
alteredimage1(:,:,3) = image11(:,:,3) + 15;
alteredimage2 = image22;
alteredimage2(:,:,2) = image22(:,:,2) + 53;
alteredimage3 = image33;
alteredimage3(:,:,2) = image33(:,:,2) + 10;
Me
Me el 18 de Nov. de 2022
Oooh okay! Thank you so much! I don't know why I didn't think of that. I really appreciate your help!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by