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 次查看(过去 30 天)
  • 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])

采纳的回答

Image Analyst
Image Analyst 2022-11-18
Try putting the altered images in the row below the originals.
imshow([image1 image2 image3; alteredimage1, alteredimage2, alteredimage3], [])
  7 个评论
Image Analyst
Image Analyst 2022-11-18
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;

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by