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])
0 件のコメント
採用された回答
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
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 Center および File 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!