필터 지우기
필터 지우기

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;
Me
Me 2022년 11월 18일
Oooh okay! Thank you so much! I don't know why I didn't think of that. I really appreciate your help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by